<?php 
require_once './../common/database.php';
session_start();
connect_db();
extract($_POST);


echo createNewMember();
//create a new member
function createNewMember(){
global $nom,$telephone,$email,$num_chambre,$pseudo,$residence_id_residence,$password;
$query="insert into membres (`nom`,`telephone`,`email`,`num_chambre`,`pseudo`,`residence_id_residence`,`password`) 
		values('$nom','$telephone','$email','$num_chambre','$pseudo','$residence_id_residence','$password')";
$result=runQuery($query);
if (!$result){
	return "impossible de creer ce compte";
}
	else return  "OK";
}

//create a new message
function createNewMessage(){
	$membres_id_membre=$_SESSION['idmembre'];
	global $nom_mess,$commentaire_mess,$etendue,$message_types_idmessage_types;
	$query="insert into messages (`nom_mess`,`commentaire_mess`,`membres_id_membre`,`etendue`,`message_types_idmessage_types`)
			values ('$nom_mess','$commentaire_mess','$membres_id_membre','$etendue','$message_types_idmessage_types')";
	$result=runQuery($query);
	if (!$result){
	return "impossible de creer ce nouveau message";
	}
	else return  "OK";
	
}
?>